/*
 * COPYRIGHT (C) 2005-2010
 * RE2, INC.
 * ALL RIGHTS RESERVED
 *
 *
 * THIS WORK CONTAINS VALUABLE CONFIDENTIAL AND PROPRIETARY INFORMATION.
 * DISCLOSURE OR REPRODUCTION WITHOUT THE WRITTEN AUTHORIZATION OF RE2, INC.
 * IS PROHIBITED. THIS UNPUBLISHED WORK BY RE2, INC. IS PROTECTED BY THE LAWS
 * OF THE UNITED STATES AND OTHER COUNTRIES. IF PUBLICATION OF THE WORK SHOULD
 * OCCUR, THE FOLLOWING NOTICE SHALL APPLY.
 *
 * "COPYRIGHT (C) 2005-2010 RE2, INC. ALL RIGHTS RESERVED."
 *
 * RE2, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
 * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
 * RE2, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
 * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
 * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 *
 */

#include "StatePublisher.h"

#include <boost/shared_ptr.hpp>
#include <ros/ros.h>

int main(int argc, char **argv)
{
  ros::init(argc, argv, "tracking_node");
  std::string robotDescription = "";
  try
  {
    ros::NodeHandle nodeHandle("tf_state_publisher");

    if(nodeHandle.hasParam("/robot_description"))
    {
    	nodeHandle.getParam("/robot_description", robotDescription);
    }
    else
    {
    	std::invalid_argument exception =  std::invalid_argument("Cannot find robot description. Aborting.");
    	throw exception;
    }
    StatePublisher * node = new StatePublisher(nodeHandle, robotDescription);
    node->start();
    delete node;
    node->stop();
  }
  catch (std::runtime_error &e)
  {
    ROS_FATAL("Uncaught exception: '%s', aborting.", e.what());
    ROS_BREAK();
  }

  return 0;
}
